<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:loadBundle  basename="resources.caption" var="caption"/>
    <h:head>
        <title>Koperasi v.1</title>
      <!--  <link href="./resources/css/default.css" rel="stylesheet" type="text/css" /> -->
       <h:outputStylesheet name="default.css" library="css" />
    </h:head>
    <h:body>
        <ui:composition>           
            <h:form id="frmUgpolicy" >
                 <p:outputPanel autoUpdate="true">
                <p:toolbar>
                    <p:toolbarGroup align="left">                        
                        <p:commandButton value="#{bundle.btnSave}" icon="ui-icon-disk"
                                         action="#{ugpolicyBean.save()}"  
										  rendered="#{menuBean.cekButtonAccess(603,'UPD;')}" 
                                         update="@this,:#{utilityBean.findClientId('treeModulePolicy')}" >
                            <f:param value="#{loginBean.selectedUser.userId}" name="userId" />
                        </p:commandButton> 

                    </p:toolbarGroup>
                </p:toolbar>
                </p:outputPanel>  
                
                
                <h:panelGrid  columns="2" style="vertical-align: top" id="pnlMainGpolicy" rowClasses="panelGridId">               
               <!-- <p:tree style="margin-left: -25px;width: 200px;border: 0" dynamic="true" value="#{ugpolicyBean.rootNode}" var="node"  selectionMode="single">
                
                                   <p:treeNode  expandedIcon="ui-icon-folder-open"  collapsedIcon="ui-icon-folder-collapsed" >#{node.menuName}</p:treeNode>
                                </p:tree>-->
                <p:dataTable id="dtUgroupsPolicy" var="ugroup" value="#{ugroupBean.ugroup}"
                             rowKey="#{ugroup.ugroupId}" selectionMode="single" selection="#{ugpolicyBean.selectedGroup}"
                                 paginator="false" rows="100" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15,30" 
                                 paginatorTemplate="{CurrentPageReport} {PreviousPageLink} {NextPageLink} {RowsPerPageDropdown}">
                    <p:ajax event="rowSelect" listener="#{ugpolicyBean.onRowSelect}" 
                           update=":#{utilityBean.findClientId('treeModulePolicy')}" />  
                     <f:facet name="header">  
                        Group User  
                    </f:facet>  
                    <p:column headerText="#{bundle.globalName}" style="width: 250">
                        <h:outputText value="#{ugroup.ugroupName}" />
                    </p:column>
                    
                </p:dataTable>
               <!--     <p:outputPanel id="treeModules" autoUpdate="true"> -->
               <p:treeTable value="#{ugpolicyBean.rootNode}" var="node" id="treeModulePolicy">
                    <f:facet name="header">  
                        List Module  #{ugpolicyBean.selectedGroup.ugroupName}
                    </f:facet> 
                    <p:column style="width:250px">  
                    <f:facet name="header">  
                        Menu Name  
                    </f:facet>  
                    <h:outputText value="#{node.menuName}" />  
                    </p:column>  
                    <p:column style="width:50px">  
                    <f:facet name="header">  
                        Can Add  
                    </f:facet> 
                        <p:selectBooleanCheckbox value="#{node.groupPolicyAction.canAdd}" rendered="#{node.policyAction.canAdd}"></p:selectBooleanCheckbox>                          
                        <h:outputText value="" rendered="#{!node.policyAction.canAdd}"/>  
                    </p:column>
                    <p:column style="width:50px">  
                    <f:facet name="header">  
                        Can Open  
                    </f:facet> 
                        <p:selectBooleanCheckbox value="#{node.groupPolicyAction.canOpen}" rendered="#{node.policyAction.canOpen}"></p:selectBooleanCheckbox>                          
                        <h:outputText value="" rendered="#{!node.policyAction.canOpen}"/>  
                    </p:column>
                     <p:column style="width:50px">  
                    <f:facet name="header">  
                        Can Update  
                    </f:facet> 
                        <p:selectBooleanCheckbox value="#{node.groupPolicyAction.canEdit}" rendered="#{node.policyAction.canEdit}"></p:selectBooleanCheckbox>                          
                        <h:outputText value="" rendered="#{!node.policyAction.canEdit}"/>  
                    </p:column>
                     <p:column style="width:50px">  
                    <f:facet name="header">  
                        Can Delete
                    </f:facet> 
                        <p:selectBooleanCheckbox value="#{node.groupPolicyAction.canDelete}" rendered="#{node.policyAction.canDelete}"></p:selectBooleanCheckbox> 
                        <h:outputText value="" rendered="#{!node.policyAction.canDelete}"/>  
                    </p:column>
                     <p:column style="width:50px">  
                    <f:facet name="header">  
                        Can Print  
                    </f:facet> 
                         <!-- {ugpolicyBean.cekAccess("PRN",ugolicyBean.selectedGroup.groupId , node.menuId)} -->
                         <p:selectBooleanCheckbox value="#{node.groupPolicyAction.canPrint}" rendered="#{node.policyAction.canPrint}"></p:selectBooleanCheckbox>                          
                        <h:outputText value="" rendered="#{!node.policyAction.canPrint}"/>  
                    </p:column>
                     <p:column style="width:50px;text-align: center" >  
                    <f:facet name="header">  
                        Can Approve  
                    </f:facet> 
                        <p:selectBooleanCheckbox  value="#{node.groupPolicyAction.canApprove}" rendered="#{node.policyAction.canApprove}"></p:selectBooleanCheckbox>                          
                        <h:outputText value="" rendered="#{!node.policyAction.canApprove}"/>  
                    </p:column>
                </p:treeTable> 
          <!--      </p:outputPanel> -->
            </h:panelGrid>
    
                         <!--   <h:form>
                                <p:tree style="margin-left: -25px;width: 200px;border: 0" dynamic="true" value="#{menuBean.rootNode}" var="node"  selectionMode="single">
                                   <p:ajax event="select" update="tabViewMenu"  listener="#{menuBean.onNodeSelect}" ></p:ajax> 
                                    <p:treeNode  expandedIcon="ui-icon-folder-open"  collapsedIcon="ui-icon-folder-collapsed" >#{node.menuName}</p:treeNode>
                                </p:tree>
                            </h:form>
                    -->
                   </h:form> 
        </ui:composition>
    </h:body>
</html>

